package pers.mobian.springninth;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

// 测试构造方法
@Component
public class User  {



	@Autowired
	private ApplicationContext applicationContext;

	private String name ;

	private int age;

	public User() {
		System.out.println(0);
	}

	public User(String name, int age) {
		System.out.println(2);

		this.name = name;
		this.age = age;
	}
	public User(String name) {
		System.out.println(1);
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}


	public void  show(){
		System.out.println(this.applicationContext.getBean("user"));
	}

}
